#ifndef BIO_PH_LIBRARY_INCLUDED
#define BIO_PH_LIBRARY_INCLUDED 1

#include "kernel/species.hpp"
#include "yocto/associative/set.hpp"

typedef set<string,Species> SpeciesSet;

class Library
{
public:	
	explicit Library();
	virtual ~Library() throw();
	void append( const Species &sp );
	void load( lua_State *L, const string &library_name );
	bool has( const string &id ) const throw();	
	
	const Species & operator[]( const string & _name ) const;
	size_t size() const throw();
	const Species & operator()( size_t index ) const throw(); //!< index in [1..size()]
	
	void close() throw();
	bool is_closed() const throw();
	
	void reset_permeabilities() const throw(); //! for each species, species.Pf=1
	
private:
	YOCTO_DISABLE_COPY_AND_ASSIGN(Library);
	SpeciesSet species_;
	bool       closed_;
};



#endif
